{extend name='common/_container'}
{block name="content"}
<div class="ibox float-e-margins">
<input type="hidden" name='sign_up_id' id='sign_up_id' value="{$info.sign_up_id}" />
	<div class="ibox-content">
		<div class="form-horizontal" id="CodeInfoForm">
			<div class="row">
				<div class="col-sm-12">
				<!-- form start -->
					<div class="form-group">
						<label class="col-sm-2 control-label">活动id：</label>
						<div class="col-sm-9">
							<input type="text" autocomplete="off" id="activity_id" value="{$info.activity_id}" name="activity_id" class="form-control" placeholder="请输入活动id">
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">用户id：</label>
						<div class="col-sm-9">
							<input type="text" autocomplete="off" id="u_id" value="{$info.u_id}" name="u_id" class="form-control" placeholder="请输入用户id">
						</div>
					</div>
					<div class="form-group layui-form">
						<label class="col-sm-2 control-label">报名状态：</label>
						<div class="col-sm-9">
							<?php if(!isset($info['status'])){ $info['status'] = '1'; }; ?>
							<input name="status" value="1" type="radio" {if condition="$info.status eq '1'"}checked{/if} title="已报名">
							<input name="status" value="0" type="radio" {if condition="$info.status eq '0'"}checked{/if} title="未报名">
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">报名时间：</label>
						<div class="col-sm-9">
							<input type="text" autocomplete="off" value="{if condition="$info.add_time neq ''"}{$info.add_time|date='Y-m-d H:i:s'}{/if}" name="add_time"  placeholder="请输入报名时间" class="form-control" id="add_time">
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">报名金额：</label>
						<div class="col-sm-9">
							<input type="text" autocomplete="off" id="sign_up_price" value="{$info.sign_up_price}" name="sign_up_price" class="form-control" placeholder="请输入报名金额">
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">创建时间：</label>
						<div class="col-sm-9">
							<input type="text" autocomplete="off" value="{if condition="$info.createtime neq ''"}{$info.createtime|date='Y-m-d H:i:s'}{/if}" name="createtime"  placeholder="请输入创建时间" class="form-control" id="createtime">
						</div>
					</div>
					<div class="form-group layui-form">
						<label class="col-sm-2 control-label">活动状态：</label>
						<div class="col-sm-9">
							<?php if(!isset($info['activity_status'])){ $info['activity_status'] = '1'; }; ?>
							<input name="activity_status" value="1" type="radio" {if condition="$info.activity_status eq '1'"}checked{/if} title="待参加">
							<input name="activity_status" value="0" type="radio" {if condition="$info.activity_status eq '0'"}checked{/if} title="已过期">
							<input name="activity_status" value="2" type="radio" {if condition="$info.activity_status eq '2'"}checked{/if} title="已参加">
						</div>
					</div>
				<!-- form end -->
				</div>
			</div>
			<div class="hr-line-dashed"></div>
			<div class="row btn-group-m-t">
				<div class="col-sm-9 col-sm-offset-1">
					<button type="button" class="btn btn-primary" onclick="CodeInfoDlg.update()" id="ensure">
						<i class="fa fa-check"></i>&nbsp;确认提交
					</button>
					<button type="button" class="btn btn-danger" onclick="CodeInfoDlg.close()" id="cancel">
						<i class="fa fa-eraser"></i>&nbsp;取消
					</button>
				</div>
			</div>
		</div>
	</div>
</div>
<script src="__PUBLIC__/static/js/upload.js" charset="utf-8"></script>
<script src="__PUBLIC__/static/js/plugins/layui/layui.js" charset="utf-8"></script>
<script>
layui.use(['form'],function(){});
laydate.render({elem: '#add_time',type: 'datetime',trigger:'click'});
laydate.render({elem: '#createtime',type: 'datetime',trigger:'click'});
var CodeInfoDlg = {
	CodeInfoData: {},
	validateFields: {
		activity_id: {
			validators: {
				notEmpty: {
					message: '活动id不能为空'
	 			},
	 		}
	 	},
		u_id: {
			validators: {
				notEmpty: {
					message: '用户id不能为空'
	 			},
	 		}
	 	},
	 }
}

CodeInfoDlg.collectData = function () {
	this.set('sign_up_id').set('activity_id').set('u_id').set('add_time').set('sign_up_price').set('createtime');
};

CodeInfoDlg.update = function () {
	 this.clearData();
	 this.collectData();
	 if (!this.validate()) {
	 	return;
	 }
	 var status = $("input[name = 'status']:checked").val();
	 var activity_status = $("input[name = 'activity_status']:checked").val();
	 var ajax = new $ax(Feng.ctxPath + "/ZhSignUp/update", function (data) {
	 	if ('00' === data.status) {
	 		Feng.success(data.msg,1000);
	 		window.parent.CodeGoods.table.refresh();
	 		CodeInfoDlg.close();
	 	} else {
	 		Feng.error(data.msg + "！",1000);
		 }
	 })
	 ajax.set('status',status);
	 ajax.set('activity_status',activity_status);
	 ajax.set(this.CodeInfoData);
	 ajax.start();
};


</script>
<script src="__PUBLIC__/static/js/base.js" charset="utf-8"></script>
{/block}
